#include <QTime>
#include "game.h"
#include "ball.h"

int qrand_in_range(int left, int right)
{
    return qrand() % ((right + 1) - left) + left;
}

Game::Game(QObject *parent) :
    QGraphicsScene(parent)
{
    QTime time = QTime::currentTime();
    qsrand((uint)time.msec());

    for (size_t i = 0; i < 7; ++i)
    {
        addItem(new Ball(qrand_in_range(20, 50),
                         qrand_in_range(0, 300),
                         qrand_in_range(0, 300)));
    }
}
